package com.ttnet.bo.implemantations;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import org.hibernate.criterion.Criterion;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.ttnet.bo.UserBo;
import com.ttnet.dao.UserDao;
import com.ttnet.model.User;
import com.ttnet.model.enumerations.Role;

@Component
@Scope("prototype")
public class UserBoImpl implements UserBo {

	@Inject
	UserDao userDao;

	@Override
	public void addUser(User user) {
		userDao.addEntity(user);
	}

	@Override
	public void updateUser(User user) {

		userDao.updateEntity(user);
	}

	@Override
	public void removeUser(User user) {
		userDao.removeEntity(user);
	}

	@Override
	public User getUserById(long userId) {
		return userDao.findEntity(userId);
	}

	@Override
	public List<User> findAllUser() {
		return userDao.findEntities();
	}

	@Override
	public User getUserByUserName(String userName) {
		return userDao.getUserByUserName(userName);
	}

	@Override
	public List<User> findUserByRole(Role role) {
		return userDao.findUserByRole(role);
	}
}